package com.agritech.state;

import com.agritech.machine.AgriculturalMachineContext;

public class MaintenanceState implements MachineState {
    @Override
    public void start(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 正在维修中，无法启动。");
    }

    @Override
    public void stop(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 正在维修中，本身已停止。");
    }

    @Override
    public void work(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 正在维修中，无法作业。");
    }

    @Override
    public void fix(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 完成维修，返回空闲状态。");
        // 模拟维修后油量加满
        machine.setFuelLevel(100.0);
        machine.setState(new IdleState());
    }

    @Override
    public String getStateName() {
        return "维修中";
    }
}